import request from '@/utils/request'

export function login(data) {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/userLogin.do',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/genauth/userManage/getLoginUserInfo.do',
    method: 'post',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/genauth/userManage/userLogout.do',
    method: 'post'
  })
}

export function queryUser(data) {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/queryUser.do',
    method: 'post',
    params: data
  })
}

export function modifyUser(data) {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/modifyUser.do',
    method: 'post',
    params: data
  })
}

export function deleteUser(userId) {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/deleteUser.do',
    method: 'post',
    params: { 'userId': userId }
  })
}

export function queryRole() {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/queryRole.do',
    method: 'post'
  })
}

export function upsertRole(data) {
  return request({
    url: '/genauth/userManage/modifyRole.do',
    method: 'post',
    params: data
  })
}

export function deleteRole(roleIds) {
  return request({
    // url: '/user/login',
    url: '/genauth/userManage/deleteRole.do',
    method: 'post',
    params: { 'roles': roleIds }
  })
}

export function queryAllMenu() {
  return request({
    url: '/genauth/userManage/querySubMenu.do',
    method: 'post'
  })
}

export function confirmRA(data) {
  return request({
    url: '/genauth/userManage/updateRA.do',
    method: 'post',
    params: data
  })
}

export function confirmUR(data) {
  return request({
    url: '/genauth/userManage/updateUR.do',
    method: 'post',
    params: data
  })
}
